package com.api.regression.group.createexternallink.folder;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IGroupApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/group/group-context.xml" })
public class CreateExternalLinkNotEditor extends AbstractApiTest {

	@Value("#{editgroupdocuments['user.notEditor'].appId}")
	private String userUrn;

	@Value("#{editgroupdocuments['user.notEditor'].password}")
	private String userPassword;

	@Value("#{editgroupdocuments['group.toCreate'].urn}")
	private String groupUrn;

	@Value("#{editgroupdocuments['group.toCreate'].folderUrn}")
	private String groupFolderUrn;

	@BeforeClass
	protected void loginUser() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public void testCreateGroupFolder() throws ZyncroApiException {

		String name = "Link Name";
		String url = "http://www.clarin.com";
		String description = "Link Descripton";

		getApi().getService(IGroupApiService.class).createExternalLinkByDocumentId(groupUrn, groupFolderUrn, name, url, description);
	}
}
